<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <meta charset="UTF-8">
        <title>表单当前页面提交</title>
    </head>
    <body>
        <?php
        $sex = isset($_GET["Sex"]) ? htmlspecialchars($_GET["Sex"]) : '';
        if($sex){
            echo $sex;
        }
        
        $fruite= isset($_GET["fruite"])?$_GET["fruite"]:'';
        
        echo '<br>';
        var_dump($fruite);
        echo '<br>';
        if(is_array($fruite)){
            
            $arr=array(
                'apple'=>'苹果',
                'lizi'=>'李子',
                'pear'=>'梨子',
                'strawberry'=>'草莓'
            );
            
//            var_dump($arr);
            
            echo '<br>';
            
            foreach ($fruite as $i){
//                echo $i . '<br>';
                echo $arr[$i]. '<br/>';
            }
            
        };
        ?>
        <form action="form.php" method="get">
            <select name="Sex">
                <option value="3">中性</option>
                <option value="1">男性</option>
                <option value="2">女性</option>
            </select>
            
            <select name="fruite[]" multiple="multiple">
                <option value="apple">苹果</option>
                <option value="lizi">李子</option>
                <option value="pear">梨子</option>
                <option value="strawberry">草莓</option>
            </select>
            
            <input type="submit" value="提交">
        </form>
    </body>
</html>
